/**
 * 把axios传来的string转化为相对可操作的数组对象。
 * row是json字符串
 * sum是key个数
 */

export class JsonUtil {
  static toArray(raw:string , sum :number) :string[] {
    let res:string[] = [];
    raw = raw.replace("}",",");
    raw += "\"";

    let index:number=  raw.indexOf("\"");;
    let index2:number;


    for(let i = 0; i < sum; i ++)
    {
      index2 = raw.indexOf("\"",index+1);
      index = raw.indexOf("\"",index2+1);
      let temp:string = (raw.substring(index2+2,index-1));
      res.push(temp)
    }

    // console.log(res.toString() + "333333333")
    // {"lat":200,"lon":100,"speed":-1}

    return res;
  }
}